﻿using System.Collections;
using System.Collections.Generic;

namespace OpenLS.Spreadsheet.StandardAddIn
{
    class RowArrayValue: IArray
    {
        private readonly List<object> _rowObjects;

        public RowArrayValue(IEnumerable<object> rowObjects)
        {
            this._rowObjects = new List<object>(rowObjects);
        }
        public RowArrayValue(IEnumerable<double> rowObjects)
        {
            this._rowObjects = new List<object>();
            foreach (var v in rowObjects)
                _rowObjects.Add(v);
        }
        public IEnumerator<object> GetEnumerator()
        {
            return _rowObjects.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }

        public object this[int row, int column]
        {
            get { return this._rowObjects[row]; }
        }

        public int RowCount
        {
            get { return _rowObjects.Count; }
        }

        public int ColumnCount
        {
            get { return 1; }
        }
    }
}